<%--
  Created by IntelliJ IDEA.
  User: 冷
  Date: 2017/9/29
  Time: 18:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册</title>
</head>
<body>
<form action="/untitled3/registerServlet" method="get">
    <table border="0" align="center">
        <tr>
            <td>用户名：</td>
            <td><input type="text" name="user" value=""></td>
        </tr>
        <tr >
            <td>登录密码</td>
            <td><input id="pw" type="password" name="pass" value=""></td>
        </tr>
        <tr >
            <td>确认密码</td>
            <td><input id="pwt" type="password" name="pass" value=""></td>
        </tr>
        <tr>
            <td colspan="2" align="center"><input id="sub" type="submit" value="提交信息"></td>
        </tr>
    </table>
</form>
</body>
</html>
<script>
    (function(){
        var sub = document.getElementById(");
        //初始化移入移出事件
        if(sub.addEventListener){
            sub.addEventListener("click", test);
        }else if(sub.attachEvent){
            sub.attachEvent("onClick", test);
        }
    })();
    function test(){
        var password = document.getElementById("pw");
        var passwordConfirm = document.getElementById("pwt");
        if(password.value != passwordConfirm.value)
            alert("对不起，您两次输入的密码不一致");
        else
            document.forms[0].sub
    }

</script>
